package com.cet;

import java.util.stream.Stream;

import static java.util.stream.Stream.builder;

public class StreamAPIDemo {

    public static void main(String[] args) {
        Stream.of(1,2,3,4,5)
                .parallel()
                .filter(i -> {
                    System.out.println("filter使用的线程："+Thread.currentThread().getName());
                    return i % 2 == 0;
                })
                .max(Integer::compareTo)
                .ifPresent(System.out::println);

        Stream<Object> build = builder().add("aaa").add("bbb").add("ccc").build();
    }
}
